package com.spring.di.example;

import com.spring.di.example.pojo.Student;
import com.spring.di.example.pojo.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class testPojo {
    @Test
    public void testStudent(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Student student = (Student) context.getBean("student");
        //System.out.println(student.getName());
        //System.out.println(student.getAddress());
        System.out.println(student.toString());
    }
    /*
    Student{
    name='Tom',
    address=Address{address='��������'},
    books=[��¥��, ���μ�, ˮ䰴�, ��������],
    hobbys=[����, �ô���, ����Ӱ],
    card={
    ���֤=666666,
     ���п�=88888888
     },
    games=[LOL, COC, BOB],
    couple='null',
    info={
    password=123456,
    driver=com.mysql.jdbc.driver,
    url=http:/localhost:8080/spring_db,
    username=root
    }
    }
     */


    @Test
    public void testUser1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        User user = context.getBean("user1", User.class);
        System.out.println(user);
    }

    @Test
    public void testUser2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        User user = context.getBean("user2", User.class);
        System.out.println(user);
    }
}
